FROM maven:3.8.5-openjdk-17

ENV SPRING_HOME=/subfg
ENV DEPLOY_DIR=/subfg/server

WORKDIR $SPRING_HOME
COPY . $SPRING_HOME/target

EXPOSE 9999 9999


RUN mkdir -p $DEPLOY_DIR \
    && mv ./target/distribution/payment-0.0.1-SNAPSHOT/* ./server \
    && mv ./target/Dockerfile ./ \
    && rm -rf target

ENTRYPOINT ["bash", "-c", "/subfg/server/bin/server.sh start-debug"]
